home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT01.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  2.0 KB  |  48 lines

  1. /*
  2. ==============================================================================
  3.                       WordUp Graphics Toolkit Version 5.0                     
  4.                              Demonstration Program 1                          
  5.                                                                               
  6.  Simply starts the graphics mode (320x200x256), draws a line, gets a key,     
  7.  returns to text mode, and exits.                                             
  8.                                                                               
  9.  Uses wgetmode and wsetmode to save and restore the video mode used before    
  10.  running this program.                                                        
  11.                                                                               
  12.  *** PROJECT ***                                                             
  13.  This program requires the file WGT5_WC.LIB to be linked.                    
  14.                                                                               
  15.  *** DATA FILES ***                                                          
  16.  NONE                                                                        
  17.                                                            WATCOM C++ VERSION 
  18. ==============================================================================
  19. */
  20.  
  21. #include <wgt5.h>
  22.  
  23.  
  24. void main(void)
  25. {
  26.   short oldmode;
  27.  
  28.   printf ("WGT Example #1\n\n");
  29.   printf ("This program will draw a single white diagonal line across the\n");
  30.   printf ("screen and wait for a keypress.\n");
  31.   printf ("\n\nPress any key to continue.\n");
  32.   getch ();
  33.  
  34.   if ( !vgadetected() )
  35.   {
  36.     printf("Error - VGA card required for any WGT program.\n");
  37.     exit(0);
  38.   }
  39.  
  40.   oldmode = wgetmode();         /* Gets the current mode */
  41.   vga256();                     /* Initializes WGT system */
  42.  
  43.   wsetcolor(15);
  44.   wline(0,0,319,199);           /* Draw a line */
  45.   getch();
  46.   wsetmode(oldmode);            /* Restore old video mode */
  47. }
  48.